<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>星座作业</title>
	<script src="jquery.min.js"></script>
</head>
<body>
	<select name="" id="bt0"></select>
	<h1 id="tit"></h1>
	<h2 id="today"></h2>
	<h2 id="tomday"></h2>
	<h2 id="week"></h2>
	<h2 id="month"></h2>
	<h2 id="year"></h2>

	<script>
		$(function(){
			$.ajax({
				type:"get",
				url:"http://apis.baidu.com/netpopo/astro/all",
				data:{},
				headers:{"apikey":"84f53877128c482353fc63eeb4473a60"},
				dataType:"json",
				success:function(data){
					let result=data.result;
					let str="";
					for(let i=0;i<result.length;i++){
						str+="<option>"+result[i].astroname+"</option>";
					}
					$("#bt0").html(str)

					$("#bt0").change(function(){
						let index=$("#bt0 :selected").index()+1;
						$.ajax({
							type:"get",
							url:"http://apis.baidu.com/netpopo/astro/fortune?astroid="+index,
							data:{},
							headers:{"apikey":"84f53877128c482353fc63eeb4473a60"},
							dataType:"json",
							success:function(data){
								let result1=data.result;
								let str1="";
								console.log(result1)
								$("#tit").html(result1.astroname);
								$("#today").html(result1.today.presummary);
								$("#tomday").html(result1.tomorrow.presummary);
								$("#week").html(result1.week.money);
								$("#month").html(result1.month.money);
								$("#year").html(result1.year.money);
							}
						})
					})
				}
			})
		})
	</script>
</body>
</html>